﻿// ====================================
// Created By Angie.D 2010.6
// ====================================

using System;
using System.Collections.Generic;
using System.Text;

using System.IO;
using System.Xml;
using System.Xml.Serialization;

namespace WOWMultiPlay
{
    [XmlRootAttribute("mpProfile", IsNullable = false)]
    public class mpProfile
    {
        [XmlIgnore]
        public string ProfilePath;
        public string ProfileName { get; set; }
        public List<mpButton> mpButtons { get; set; }

        public mpProfile() { }

        public mpProfile(string profilePath) 
        {
            LoadProfile(profilePath);
        }

        public void LoadProfile(string profilePath)
        {
            if (Serializer<mpProfile>.CanDeserialize(profilePath))
            {
                mpProfile loadedProfile = Serializer<mpProfile>.Deserialize(profilePath);
                this.ProfilePath = profilePath;
                this.ProfileName = loadedProfile.ProfileName;
                this.mpButtons = loadedProfile.mpButtons;
            }
        }

        public void SaveProfile(string profilePath)
        {
            Serializer<mpProfile>.Serialize(this, profilePath);
        }
    }
}